<?php 

class Model_category extends CI_Model {
    
    function __construct() {
        parent::__construct();
    }

    function getCat($id) {
        $collection = $this->mongo_db->db->selectCollection('category');
        $cat = $collection->findOne(array("_id" => $id));
        return $cat;	
    }

    function getCats() {
    	$collection = $this->mongo_db->db->selectCollection('category');
        $cats = $collection->find();
        return $cats;
    }

    function getSections() {
        $collection = $this->mongo_db->db->selectCollection('category');
        $cats = $collection->find(array('parent' => null));
        $cats->sort(array('type'=>1));
        return $cats;
    }

}

?>